/**
 * Project Name:bfs_v1.0.1
 * File Name:UserPntenterController.java
 * Package Name:com.zeei.bfs.controller
 * Date:2016年12月19日上午11:11:30
 * Copyright (c) 2016, ZEEI All Rights Reserved. *
 *
 * ClassName:UserPntenterController 
 * Function: TODO ADD FUNCTION.  
 * @author   zws 
 * @since    JDK 1.8	 
 */

package com.zeei.bfs.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zeei.bfs.service.UserPntenterService;
import com.zeei.common.controller.BasicController;
import com.zeei.common.utils.SessionInfoUtil;
import com.zeei.common.utils.StringUtil;
import com.zeei.common.vo.ResultBasicVO;
import com.zeei.common.vo.UserPntenterVO;
import com.zeei.common.vo.UserVO;

@Controller
@RequestMapping("/bfs/userpntenter")
public class UserPntenterController extends BasicController{

	@Resource
	private UserPntenterService userPntenterService;

	@RequestMapping(value = "/save", method = RequestMethod.POST)
	@ResponseBody
	public ResultBasicVO saveUserPntenter(Integer userId,String objIds, String type) {
		List<String> objIdList=StringUtil.splitToList(objIds);
		Integer createId = SessionInfoUtil.getSessionUserId();
		boolean successState = userPntenterService.saveUserPntenter(userId,objIdList,  createId, type);
		return this.createResultBasicVO(successState, null);
	}

	@RequestMapping(value = "/add", method = RequestMethod.POST)
	@ResponseBody
	public ResultBasicVO addUserPntenter(Integer userId,Integer objId, String type) {
		Integer createId = SessionInfoUtil.getSessionUserId();
		boolean successState = userPntenterService.addUserPntenter(userId,objId,  createId, type);
		return this.createResultBasicVO(successState, null);
	}

	@RequestMapping(value = "/list", method = RequestMethod.POST)
	@ResponseBody
	public List<UserPntenterVO> queryUserPntenter(Integer userId, String type) {
		UserVO currentUser = SessionInfoUtil.getSessionUserInfo();
		return userPntenterService.queryUserPntenter(userId, type,currentUser);
	}

}
